<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">
    <title>Form Layouts</title>
    <?php $this->load->view('library/header');?>
</head>
<body class="sticky-header">
<style>
    .flex-x{
        display: flex;
        flex-direction: row
    }
    .flex-y{
        display: flex;
        flex-direction: column;
    }
    .mtop10{
        margin-left: 47px;
        margin-right: 15px;
    }
    .Awaiting-audit-btn{
        cursor:pointer;
    }
    .Awaiting-audit-btn:hover +.Awaiting-audit{
        display: block;
    }
    .Awaiting-audit{
        position: absolute;
        width: 320px;
        display: none;
        opacity:1;
    }
    .Awaiting-audit1{
        position: relative;
        background-color: white;
        border: 1px solid #DDDDDD;
        top: 20px;
    }
    .audit1Reason{
        height: 37px;
        line-height: 37px;
        background-color: #65CEA7;
        color: white;
        padding-left: 122px;
    }
    .yuanyin{
        width: 68%;
        margin: 0 auto;
    }
    .fz1{
        margin-top: 115px;
    }
    .fz3{
        width: 140px !important;
    }
    .fz2{
        display: flex;
    }
    /*详情弹出框样式*/
    .modal-content{
        width: 731px;
    }
    .look-1-left{
        margin-left: 61px;
        margin-right: 40px;
    }
    .m-top{
        margin-top: 10px;
    }
    .m-left{
        margin-left: 46px;
    }
    .zhandian-yang{
        margin-bottom: 10px;
        padding: 10px 20px 10px 15px;
        background-color: aliceblue;
    }
    .shangjia{
        display: none;
    }
    .shangjia:nth-child(1){
    
        display: block;
    }
    .shangjia:nth-child(2){

        display: block;
    }
     .zhandiansku:hover .shangjia{
        display: block;
    }
    .zongxiaoliang{
         display: none;
    }
    .zongxiaoliang:nth-child(1){
    
        display: block;
    }
    .zongxiaoliang:nth-child(2){
     
        display: block;
    }
    .xiaoliang:hover .zongxiaoliang{
        display: block;
    }

</style>
<section>
    <?php $this->load->view('library/left');?>
    <div class="main-content" >
        <div class="zhezhao"></div>
        <?php $this->load->view('library/top');?>
        <div class="page-heading">
            <h3>新品数据订单</h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">Forms</a>
                </li>
                <li class=""> Forms Layouts </li>
            </ul>
        </div>
<section class="wrapper">
    <section class="panel">
        <header class="panel-heading custom-tab turquoise-tab">
            <ul class="nav nav-tabs">
                <li class="">
                    <a href="<?php echo base_url('Order/order_five_sum');?>" >新商品订单</a>
                </li>
                <li class="">
                    <a href="<?php echo base_url('Order/new_goods_list');?>" >保存商品</a>
                </li>
            </ul>
        </header>
        <div class="panel-body">
                    <div class="padding-left">
                        <form class="form-horizontal bucket-form" method="get">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group ">
                                        <label class="col-sm-1 control-label">站点:</label>

                                        <div id="form_web" class="col-sm-11 slide-toggle">
                                            <div class="icheck minimal">
                                            <div class="checkbox single-row all_web_id">
                                                <input type="checkbox" <?php echo (count($param['web_id']) == count($siteweb) || count($param['web_id']) == 0) ? 'checked ' : '';?> value="<?php echo count($siteweb);?>"  >
                                                <label>全部</label>
                                            </div>
                                            <?php if ($param['web_id']): ?>
                                                <?php foreach ($siteweb as $web_id => $siteweb):?>
                                                    <div class="checkbox single-row web_ids">
                                                        <input type="checkbox" name="web_id[]" <?php echo in_array($web_id, $param['web_id']) ? 'checked' : '';?> value="<?php echo $web_id;?>"  >
                                                        <label><?php echo $siteweb; ?></label>
                                                    </div>
                                                <?php endforeach;?>
                                            <?php else:?>
                                            <?php foreach ($siteweb as $web_id => $siteweb):?>
                                                <div class="checkbox single-row web_ids">
                                                    <input type="checkbox" name="web_id[]" checked value="<?php echo $web_id;?>"  >
                                                    <label><?php echo $siteweb; ?></label>
                                                </div>
                                            <?php endforeach;?>
                                            <?php endif; ?>
                                            </div>
                                        </div>
                                        <label class="col-sm-1 control-label">管理员:</label>
                                        <div class="form-group col-lg-2">
                                            <select name="admin_id" class="form-control">
                                                <option value="">选择管理员</option>
                                                <?php foreach($admin as $k=>$v){?>
                                                <option value="<?php echo $k?>" <?php if($param['admin_id'] == $k){echo 'selected';}?>><?php echo $v?></option>
                                                <?php }?>
                                            </select>
                                        </div>
                                        <label class="col-sm-1 control-label">K线图搜索:</label>
                                        <div id="form_statistical" class="col-sm-6 icheck minimal">
                                            <div class="input-group input-large custom-date-range" data-date="13/07/2013" data-date-format="mm/dd/yyyy">
                                                <input type="text" value="" class="form-control dpd1" name="from" autocomplete="off">
                                                <span class="input-group-addon">To</span>
                                                <input type="text" value="" class="form-control dpd2" name="to" autocomplete="off">
                                            </div>
                                        </div>
                                        <!-- <div class="form-group col-lg-4">
                                            <div class="input-group input-large custom-date-range">
                                            <input type="text" autocomplete="off" class="form-control dpd1" name="add_time_start" value="">
                                            <span class="input-group-addon">时间</span>
                                            <input type="text" autocomplete="off" class="form-control dpd2" name="add_time_end" value="">
                                            </div>
                                        </div> -->
                                    </div>
                                    <div class="col-md-1">
                                    <button type="submit" class="btn btn-info">搜索</button>
                                </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
        <div class="panel-body">
            <div class="tab-content">
                <div class="tab-pane active" id="whole">
                    <?php $this->load->view('library/search');?>
                <section class="panel">
                        <div class="panel-body">
                            <div class="adv-table">
                                <table class="display table table-bordered table-striped" id="dynamic-table">
                                    <tr>
                                        <th width="3%">商品图片</th>
                                        <th width="10%">商品货号</th>
                                        <th width="10%">总数量</th>
                                        <th width="10%">上架站点（sku）</th>
                                        <th width="10%">站点总销量</th>
                                        <th width="10%">操作</th>
                                    </tr>
                                    <?php foreach($order_list as $k=>$item){?>
                                            <tr class="gradeX">
                                                <td>
                                                    <img style="width: 100px;" class="img" src="<?php echo $item['original_img'];?>" />
                                                </td>
                                                
                                                <td>
                                                    <?php echo $item['goods_sn'];?>
                                                </td>
                                                <td>
                                                    <?php echo $item['count_number'];?>件
                                                </td>






                                                <td class="zhandiansku">
                                                    <?php foreach($item['web_sum'] as $key=>$val){?>
                                                        <p class="shangjia">站点：<?php echo $key?> 销量：（<?php echo $val?>件）
                                                        </p>
                                                    <?php }?>
                                                </td>


                                                <td class="xiaoliang">
                                                    <?php foreach($item['sku_sum'] as $key=>$val){?>
                                                        <p class="zongxiaoliang"><?php echo $key;?>销量：<?php echo $val;?>件</p>
                                                    <?php }?>
                                                </td>







                                                <td>
                                                    <button class="btn btn-info del_goods" data-id="<?php echo $item['id']?>">删除商品</button>
                                                    <!-- <button class="btn btn-info " >K线图</button> -->
                                                     <a class="btn btn-xs btn-info K_goods shenhe_img" href="#myModal" data-goods_id="<?php echo $item['goods_id']?>" style="width: 50px;height: 33px" data-goods_id="<?php echo $item['prepare_id']?>" data-toggle="modal">K线图</a>
                                                </td>
                                            </tr>
                                        <?php }?>
                                    </tbody>
                                </table>
                            </div>
                            <div>
                            </div>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="dataTables_paginate paging_bootstrap pagination">
                                        <ul>
                                            <?php echo $pages;?>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </div>
        </div>



<!--    查看弹窗-->
    <div class="modal fade" id="look" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header"><h4 class="modal-title">详情</h4></div>
                <div class="modal-body row log_show look-1">
                    <div class="flex-x strimg">
                        
                    </div>

                </div>
            </div>
        </div>
    </div>

    <!-- k线图弹窗 -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header"><h4 class="modal-title">图表</h4></div>
            <div class="modal-body row ">
                            
                <div class="" float:left;posttion:relative">
                    <h5 >当前周用户注</h5>
                    <canvas id="currentWeekChart" width="500" height="300"></canvas>

                </div>
            </div>
        </div>
    </div>
</div>

    </section>
</section>

    </div>
</section>
<?php $this->load->view('library/footer');?>
</body>
</html>
<script src="/public/js/scripts.js"></script>
<script src="/public/js/Chart.js"></script>
<script>
    $('.all_web_id input').click(function(){
        if($(this).is(':checked') == true){
            $('.web_ids input').each(function(){
                $(this).attr("checked",true)
            }) 
        }else{
            $('.web_ids input').each(function(){
                $(this).attr("checked",false)
            })
        }
        
    })

    $('.del_goods').click(function(){
        var id = $(this).data('id');
        var url = "<?php echo base_url('order/del_goods');?>";
        swal({
            title: '删除商品',
            showCancelButton: true,
            allowOutsideClick: false,
            confirmButtonText: 'Submit',
            preConfirm: function preConfirm(value) {
                $.ajax({
                    type:'post',
                    url:url,
                    dataType:'json',
                    data:{
                        id:id
                    },
                    success:function(data){
                        swal({
                            title:   data.info,
                            text: '2秒后关闭',
                            type: data.status,
                            allowOutsideClick: false,
                            timer: 1500,
                            showConfirmButton: false
                        }).then(function(isConfirm) {
                            location.reload();
                        });
                    }
                })
            }
        })
    })
    var aa = '';
    $('.K_goods').click(function(){
        var dpd1 = $('.dpd1').val();
        var dpd2 = $('.dpd2').val();
        if(!dpd1 || !dpd2){
            alert('选择时间')
        }
        var goods_id = $(this).data('goods_id');
        var url = "<?php echo base_url('order/k_goods');?>";
        $.ajax({
            type:'post',
            url:url,
            dataType:'json',
            data:{
                dpd1:dpd1,
                dpd2:dpd2,
                goods_id:goods_id
            },
            success:function(msg){
                var data = {
        labels: msg.labels,
        datasets: [
            {
                label: "浏览量",
                borderColor:'rgba(0, 0, 0, 0.5)',
                backgroundColor: "rgba(50, 211, 145, 0)",//线条填充色
                pointBackgroundColor:"rgba(0,48,48,0.9)",//定点填充色
                data: msg.detail_views_sum
            },
            {
                label: "加车量",
                borderColor:'rgba(255, 255, 0, 0.5)',
                backgroundColor: "rgba(10, 21, 15, 0)",//线条填充色
                pointBackgroundColor:"rgba(0,48,48,0.9)",//定点填充色
                data: msg.adds_cart_sum
            },
            {
                label: "销量",
                borderColor:'rgba(255, 97, 3, 0.5)',
                backgroundColor: "rgba(0, 11, 145, 0)",//线条填充色
                pointBackgroundColor:"rgba(0,48,48,0.9)",//定点填充色
                data: msg.item_quantity_sum
            },
        ]
    };
    var options = {};
    var ctx = document.getElementById("currentWeekChart").getContext("2d");
    var currentWeekChart = new Chart(ctx,{
        type: 'line',
        data: data,
        options:options
    });
            }
        })
    })
</script>
